package day05;

import java.util.HashMap;
import java.util.Set;

public class MapExercise {
    public static void main(String[] args) {
        HashMap hashMap = new HashMap();
        Employee e1 = new Employee("milan", 20000, "1");
        Employee e2 = new Employee("tom", 20000, "2");
        Employee e3 = new Employee("jake", 10000, "3");
        hashMap.put(e1.getId(),e1);
        hashMap.put(e2.getId(),e2);
        hashMap.put(e3.getId(),e3);
        System.out.println(hashMap);
        Set set = hashMap.keySet();
        for (Object o :set) {
            Object o1 = hashMap.get(o);
            Employee o11 = (Employee) o1;
            if(o11.getSal() > 18000) {
                System.out.println(o11);
            }
        }

    }
}
class Employee {
    private String name;
    private double sal;
    private String id;

    public Employee(String name, double sal, String id) {
        this.name = name;
        this.sal = sal;
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getSal() {
        return sal;
    }

    public void setSal(double sal) {
        this.sal = sal;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return "name=" + name + "\t" +
                "sal=" + sal;
    }
}
